Use regexp-opt for regexps
authorJustin Burkett <justin@burkett.cc>
Fri, 19 May 2017 21:53:43 +0000 (17:53 -0400)
committerJustin Burkett <justin@burkett.cc>
Fri, 19 May 2017 21:53:43 +0000 (17:53 -0400)
* which-key.el (which-key--get-keymap-bindings): Update

which-key.el

index 8f1b038292f8477fd20705cdf666aefd2659c5cc..50a3f84baca9ba97dd48093710e00c6a223bcb8f 100644 (file)
@@ -40,6 +40,7 @@
 
 (require 'cl-lib)
 (require 'button)
+(require 'regexp-opt)
 
 ;; For compiler
 (defvar evil-operator-shortcut-map)
@@ -1526,9 +1527,16 @@ Requires `which-key-compute-remaps' to be non-nil"
   "Generate a list of current active bindings."
   (let ((key-str-qt (regexp-quote (key-description which-key--current-prefix)))
         (buffer (current-buffer))
-        (ignore-bindings '("self-insert-command" "ignore" "ignore-event" "company-ignore"))
-        (ignore-keys-regexp "mouse-\\|wheel-\\|remap\\|drag-\\|scroll-bar\\|select-window\\|switch-frame\\|-state")
-        (ignore-sections-regexp "\\(Key translations\\|Function key map translations\\|Input decoding map translations\\)"))
+        (ignore-bindings '("self-insert-command" "ignore"
+                           "ignore-event" "company-ignore"))
+        (ignore-keys-regexp
+         (eval-when-compile
+           (regexp-opt '("mouse-" "wheel-" "remap" "drag-" "scroll-bar"
+                         "select-window" "switch-frame" "-state"))))
+        (ignore-sections-regexp
+         (eval-when-compile
+           (regexp-opt '("Key translations" "Function key map translations"
+                         "Input decoding map translations")))))
     (with-temp-buffer
       (setq-local indent-tabs-mode t)
       (setq-local tab-width 8)